#!/usr/bin/env bash

# Copyright (c) 2014, Joyent, Inc. All rights reserved.
#
# Common variables used by scripts in /lib/smartdc

# location of binaries that functions use
LOGGER=`which logger 2> /dev/null`
UNAME_BIN=`which uname 2> /dev/null`
MOUNT_BIN=`which mount 2> /dev/null`

MDATA_GET_BIN='/usr/sbin/mdata-get'
SEND_ARP_UPDATES_BIN='/lib/smartdc/send-arp-updates'

# location of common files
USER_SCRIPT_FILE='/var/tmp/user-script'
USER_SCRIPT_LOCKFILE='/var/tmp/user-script.lock'

# Common functions used by scripts /lib/smartdc

lib_smartdc_fatal() {
  echo " "
  printf "(fatal) %s\n" "$@"
  echo " "
  echo " "
  $LOGGER "(fatal) - $0 - $@"
  exit 1
}

lib_smartdc_info() {
  printf "(info) %s\n" "$@"
  $LOGGER "(info) - $0 - $@"
}

# start of main

export -f lib_smartdc_fatal
export -f lib_smartdc_info
